home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 3.iso / dist / fw_squid.idb / usr / freeware / squid / doc / icpv2-protocol.txt.z / icpv2-protocol.txt
Text File  |  2000-04-13  |  20KB  |  507 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                         D. Wessels
  8. Internet-Draft                                                 K. Claffy
  9.                                          National Laboratory for Applied
  10. Obsoletes <draft-wessels-icp-v2-02.txt>            Network Research/UCSD
  11. Expires: November 27, 1997                                   27 May 1997
  12.  
  13.  
  14.  
  15.                 Internet Cache Protocol (ICP), version 2
  16.                      <draft-wessels-icp-v2-03.txt>
  17.  
  18.  
  19. Status of this Memo
  20.  
  21.    This document is an Internet-Draft. Internet-Drafts are working
  22.    documents of the Internet Engineering Task Force (IETF), its areas,
  23.    and its working groups. Note that other groups may also distribute
  24.    working documents as Internet-Drafts.
  25.  
  26.    Internet-Drafts are draft documents valid for a maximum of six months
  27.    and may be updated, replaced, or obsoleted by other documents at any
  28.    time. It is inappropriate to use Internet-Drafts as reference
  29.    material or to cite them other than as ``work in progress.''
  30.  
  31.    To learn the current status of any Internet-Draft, please check the
  32.    ``1id-abstracts.txt'' listing contained in the Internet-Drafts Shadow
  33.    Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
  34.    munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
  35.    ftp.isi.edu (US West Coast).
  36.  
  37. Abstract
  38.  
  39.    This draft document describes version 2 of the Internet Cache
  40.    Protocol (ICPv2) as currently implemented in two World-Wide Web proxy
  41.    cache packages[3,5].  ICP is a lightweight message format used for
  42.    communicating among Web caches.  ICP is used to exchange hints about
  43.    the existence of URLs in neighbor caches.  Caches exchange ICP
  44.    queries and replies to gather information to use in selecting the
  45.    most appropriate location from which to retrieve an object.
  46.  
  47.    This document describes only the format and fields of ICP messages.
  48.    A companion document (RFCXXXX, <draft-wessels-icp-v2-appl-01.txt>)
  49.    describes the application of ICP to Web caches.  Several independent
  50.    caching implementations now use ICP, and we consider it important to
  51.    codify the existing practical uses of ICP for those trying to
  52.    implement, deploy, and extend its use for their own purposes.
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Wessels                                                         [Page 1]
  59.  
  60. Internet-Draft                                             22 April 1997
  61.  
  62.  
  63. 1.  Introduction
  64.  
  65.    ICP is a message format used for communicating between Web caches.
  66.    Although Web caches use HTTP[1] for the transfer of object data,
  67.    caches benefit from a simpler, lighter communication protocol.  ICP
  68.    is primarily used in a cache mesh to locate specific Web objects in
  69.    neighboring caches.  One cache sends an ICP query to its neighbors.
  70.    The neighbors send back ICP replies indicating a "HIT" or a "MISS."
  71.  
  72.    In current practice, ICP is implemented on top of UDP, but there is
  73.    no requirement that it be limited to UDP.  We feel that ICP over UDP
  74.    offers features important to Web caching applications.  An ICP
  75.    query/reply exchange needs to occur quickly, typically within a sec-
  76.    ond or two.  A cache cannot wait longer than that before beginning to
  77.    retrieve an object.  Failure to receive a reply message most likely
  78.    means the network path is either congested or broken.  In either case
  79.    we would not want to select that neighbor.  As an indication of imme-
  80.    diate network conditions between neighbor caches, ICP over a
  81.    lightweight protocol such as UDP is better than one with the overhead
  82.    of TCP.
  83.  
  84.    In addition to its use as an object location protocol, ICP messages
  85.    can be used for cache selection.  Failure to receive a reply from a
  86.    cache may indicate a network or system failure.  The ICP reply may
  87.    include information that could assist selection of the most appropri-
  88.    ate source from which to retrieve an object.
  89.  
  90.    ICP was initially developed by Peter Danzig, et. al.  at the Univer-
  91.    sity of Southern California as a central part of hierarchical caching
  92.    in the Harvest research project[3].
  93.  
  94. ICP Message Format
  95.  
  96.    The ICP message format consists of a 20-octet fixed header plus a
  97.    variable sized payload (see Figure 1).
  98.  
  99.    NOTE: All fields must be represented in network byte order.
  100.  
  101.    Opcode
  102.       One of the opcodes defined below.
  103.  
  104.    Version
  105.       The ICP protocol version number.  At the time of this writing,
  106.       both versions two and three are in use.  This document describes
  107.       only version two.  The version number field allows for future
  108.       development of this protocol.
  109.  
  110.    Message Length
  111.  
  112.  
  113.  
  114. Wessels                                                         [Page 2]
  115.  
  116. Internet-Draft                                             22 April 1997
  117.  
  118.  
  119.      0                   1                   2                   3
  120.     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  121.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  122.    |     Opcode    |    Version    |         Message Length        |
  123.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  124.    |                         Request Number                        |
  125.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  126.    |                            Options                            |
  127.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  128.    |                          Option Data                          |
  129.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  130.    |                       Sender Host Address                     |
  131.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  132.    |                                                               |
  133.    |                            Payload                            |
  134.    /                                                               /
  135.    /                                                               /
  136.    |                                                               |
  137.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  138.  
  139.                        FIGURE 1: ICP message format.
  140.  
  141.       The total length (octets) of the ICP message.  ICP messages MUST
  142.       not exceed 16,384 octets in length.
  143.  
  144.    Request Number
  145.       An opaque identifier.  When responding to a query, this value must
  146.       be copied into the reply message.
  147.  
  148.    Options
  149.       A 32-bit field of option flags that allows extension of this ver-
  150.       sion of the protocol in certain, limited ways.  See ``ICP Option
  151.       Flags'' below.
  152.  
  153.    Option Data
  154.       A four-octet field to support optional features.  The following
  155.       ICP features make use of this field:
  156.  
  157.       The ICP_FLAG_SRC_RTT option uses the low 16-bits of Option Data to
  158.       return RTT measurements.  The ICP_FLAG_SRC_RTT option is further
  159.       described below.
  160.  
  161.    Sender Host Address
  162.       The IPv4 address of the host sending the ICP message.  This field
  163.       should probably not be trusted over what is  provided by getpeer-
  164.       name(), accept(), and recvfrom().  There is some ambiguity over
  165.       the original purpose of this field.  In practice it is not used.
  166.  
  167.  
  168.  
  169.  
  170. Wessels                                                         [Page 3]
  171.  
  172. Internet-Draft                                             22 April 1997
  173.  
  174.  
  175.    Payload
  176.       The contents of the Payload field vary depending on the Opcode,
  177.       but most often it contains a null-terminated URL string.
  178.  
  179.  
  180. 2.  ICP Opcodes
  181.  
  182. The following table shows currently defined ICP opcodes:
  183.  
  184.    Value    Name
  185.    -----    -----------------
  186.        0    ICP_OP_INVALID
  187.        1    ICP_OP_QUERY
  188.        2    ICP_OP_HIT
  189.        3    ICP_OP_MISS
  190.        4    ICP_OP_ERR
  191.      5-9    UNUSED
  192.       10    ICP_OP_SECHO
  193.       11    ICP_OP_DECHO
  194.    12-20    UNUSED
  195.       21    ICP_OP_MISS_NOFETCH
  196.       22    ICP_OP_DENIED
  197.       23    ICP_OP_HIT_OBJ
  198.  
  199.    ICP_OP_INVALID
  200.       A place holder to detect zero-filled or malformed messages.  A
  201.       cache must never intentionally send an ICP_OP_INVALID message.
  202.       ICP_OP_ERR should be used instead.
  203.  
  204.    ICP_OP_QUERY
  205.       A query message.  NOTE this opcode has a different payload format
  206.       than most of the others.  First is the requester's IPv4 address,
  207.       followed by a URL.  The Requester Host Address is not that of the
  208.       cache generating the ICP message, but rather the address of the
  209.       caches's client that originated the request.  The Requester Host
  210.       Address is often zero filled.  An ICP message with an all-zero
  211.       Requester Host Address address should be taken as one where the
  212.       requester address is not specified; it does not indicate a valid
  213.       IPv4 address.
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. Wessels                                                         [Page 4]
  227.  
  228. Internet-Draft                                             22 April 1997
  229.  
  230.  
  231.       ICP_OP_QUERY payload format:
  232.  
  233.         0                   1                   2                   3
  234.        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  235.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  236.       |                     Requester Host Address                    |
  237.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  238.       |                                                               |
  239.       /                       Null-Terminated URL                     /
  240.       /                                                               /
  241.       |                                                               |
  242.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  243.  
  244.  
  245.       In response to an ICP_OP_QUERY, the recipient must return one of:
  246.       ICP_OP_HIT, ICP_OP_MISS, ICP_OP_ERR, ICP_OP_MISS_NOFETCH,
  247.       ICP_OP_DENIED, or ICP_OP_HIT_OBJ.
  248.  
  249.    ICP_OP_SECHO
  250.       Similar to ICP_OP_QUERY, but for use in simulating a query to an
  251.       origin server.  When ICP is used to select the closest neighbor,
  252.       the origin server can be included in the algorithm by bouncing an
  253.       ICP_OP_SECHO message off it's echo port.  The payload is simply
  254.       the null-terminated URL.
  255.  
  256.       NOTE: the echo server will not interpret the data (i.e. we could
  257.       send it anything).  This opcode is used to tell the difference
  258.       between a legitimate query or response, random garbage, and an
  259.       echo response.
  260.  
  261.    ICP_OP_DECHO
  262.       Similar to ICP_OP_QUERY, but for use in simulating a query to a
  263.       cache which does not use ICP.  When ICP is used to choose the
  264.       closest neighbor, a non-ICP cache can be included in the algorithm
  265.       by bouncing an ICP_OP_DECHO message off it's echo port.  The pay-
  266.       load is simply the null-terminated URL.
  267.  
  268.       NOTE: one problem with this approach is that while a system's echo
  269.       port may be functioning perfectly, the cache software may not be
  270.       running at all.
  271.  
  272.    One of the following six ICP opcodes are sent in response to an
  273.    ICP_OP_QUERY message.  Unless otherwise noted, the payload must be
  274.    the null-terminated URL string.  Both the URL string and the Request
  275.    Number field must be exactly the same as from the ICP_OP_QUERY mes-
  276.    sage.
  277.  
  278.    ICP_OP_HIT
  279.  
  280.  
  281.  
  282. Wessels                                                         [Page 5]
  283.  
  284. Internet-Draft                                             22 April 1997
  285.  
  286.  
  287.       An ICP_OP_HIT response indicates that the requested URL exists in
  288.       this cache and that the requester is allowed to retrieve it.
  289.  
  290.    ICP_OP_MISS
  291.       An ICP_OP_MISS response indicates that the requested URL does not
  292.       exist in this cache.  The querying cache may still choose to fetch
  293.       the URL from the replying cache.
  294.  
  295.    ICP_OP_ERR
  296.       An ICP_OP_ERR response indicates some kind of error in parsing or
  297.       handling the query message (e.g. invalid URL).
  298.  
  299.    ICP_OP_MISS_NOFETCH
  300.       An ICP_OP_MISS_NOFETCH response indicates that this cache is up,
  301.       but is in a state where it does not want to handle cache misses.
  302.       An example of such a state is during a startup phase where a cache
  303.       might be rebuilding its object store.  A cache in such a mode may
  304.       wish to return ICP_OP_HIT for cache hits, but not ICP_OP_MISS for
  305.       misses.  ICP_OP_MISS_NOFETCH essentially means ``I am up and run-
  306.       ning, but please don't fetch this URL from me now.''
  307.  
  308.       Note, ICP_OP_MISS_NOFETCH has a different meaning than
  309.       ICP_OP_MISS.  The ICP_OP_MISS reply is an invitation to fetch the
  310.       URL from the replying cache (if their relationship allows it), but
  311.       ICP_OP_MISS_NOFETCH is a request to NOT fetch the URL from the
  312.       replying cache.
  313.  
  314.    ICP_OP_DENIED
  315.       An ICP_OP_DENIED response indicates that the querying site is not
  316.       allowed to retrieve the named object from this cache.  Caches and
  317.       proxies may implement complex access controls.  This reply must be
  318.       be interpreted to mean ``you are not allowed to request this par-
  319.       ticular URL from me at this particular time.''
  320.  
  321.       Caches receiving a high percentage of ICP_OP_DENIED replies are
  322.       probably misconfigured.  Caches should track percentage of all
  323.       replies which are ICP_OP_DENIED and disable a neighbor which
  324.       exceeds a certain threshold (e.g. 95% of 100 or more queries).
  325.  
  326.       Similarly, a cache should track the percent of ICP_OP_DENIED mes-
  327.       sages that are sent to a given address.  If the percent of denied
  328.       messages exceeds a certain threshold (e.g. 95% of 100 or more),
  329.       the cache may choose to ignore all subsequent ICP_OP_QUERY mes-
  330.       sages from that address until some sort of administrative inter-
  331.       vention occurs.
  332.  
  333.    ICP_OP_HIT_OBJ
  334.       Just like an ICP_OP_HIT response, but the actual object data has
  335.  
  336.  
  337.  
  338. Wessels                                                         [Page 6]
  339.  
  340. Internet-Draft                                             22 April 1997
  341.  
  342.  
  343.       been included in this reply message.   Many requested objects are
  344.       small enough that it is possible to include them in the query
  345.       response and avoid the need to make a subsequent HTTP request for
  346.       the object.
  347.  
  348.       CAVEAT: ICP_OP_HIT_OBJ has some negative side effects which make
  349.       its use undesirable.  It transfers object data without HTTP and
  350.       therefore bypasses the standard HTTP processing, including autho-
  351.       rization and age validation.  Another negative side effect is that
  352.       ICP_OP_HIT_OBJ messages will often be much larger than the path
  353.       MTU, thereby causing fragmentation to occur on the UDP packet.
  354.       For these reasons, use of ICP_OP_HIT_OBJ is NOT recommended.
  355.  
  356.       A cache must not send an ICP_OP_HIT_OBJ unless the
  357.       ICP_FLAG_HIT_OBJ flag is set in the query message Options field.
  358.  
  359.       ICP_OP_HIT_OBJ payload format:
  360.  
  361.         0                   1                   2                   3
  362.        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  363.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  364.       |                                                               |
  365.       /                       Null-Terminated URL                     /
  366.       /                                                               /
  367.       |                                                               |
  368.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  369.       |         Object Size           |                               |
  370.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
  371.       |                                                               |
  372.       /                           Object Data                         /
  373.       /                                                               /
  374.       |                                                               |
  375.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  376.  
  377.  
  378.       The receiving application must check to make sure it actually
  379.       receives Object Size octets of data.  If it does not, then it
  380.       should treat the ICP_OP_HIT_OBJ reply as though it were a normal
  381.       ICP_OP_HIT.
  382.  
  383.       NOTE: the Object Size field does not necessarily begin on a 32-bit
  384.       boundary as shown in the diagram above.  It begins immediately
  385.       following the NULL byte of the URL string.
  386.  
  387.    UNRECOGNIZED OPCODES
  388.       ICP messages with unrecognized or unused opcodes should be
  389.       ignored, i.e. no reply generated.  The application may choose to
  390.       note the anomalous behaviour in a log file.
  391.  
  392.  
  393.  
  394. Wessels                                                         [Page 7]
  395.  
  396. Internet-Draft                                             22 April 1997
  397.  
  398.  
  399. 3.  ICP Option Flags
  400.  
  401.    0x80000000  ICP_FLAG_HIT_OBJ
  402.       This flag is set in an ICP_OP_QUERY message indicating that it is
  403.       okay to respond with an ICP_OP_HIT_OBJ message if the object data
  404.       will fit in the reply.
  405.  
  406.    0x40000000  ICP_FLAG_SRC_RTT
  407.       This flag is set in an ICP_OP_QUERY message indicating that the
  408.       requester would like the ICP reply to include the responder's mea-
  409.       sured RTT to the origin server.
  410.  
  411.       Upon receipt of an ICP_OP_QUERY with ICP_FLAG_SRC_RTT bit set, a
  412.       cache should check an internal database of RTT measurements.  If
  413.       available, the RTT value MUST be expressed as a 16-bit integer, in
  414.       units of milliseconds.  If unavailable, the responder may either
  415.       set the RTT value to zero, or clear the ICP_FLAG_SRC_RTT bit in
  416.       the ICP reply.  The ICP reply MUST not be delayed while waiting
  417.       for the RTT measurement to occur.
  418.  
  419.       This flag is set in an ICP reply message (ICP_OP_HIT, ICP_OP_MISS,
  420.       ICP_OP_MISS_NOFETCH, or ICP_OP_HIT_OBJ) to indicate that the low
  421.       16-bits of the Option Data field contain the measured RTT to the
  422.       host given in the requested URL.  If ICP_FLAG_SRC_RTT is clear in
  423.       the query then it MUST also be clear in the reply.  If
  424.       ICP_FLAG_SRC_RTT is set in the query, then it may or may not be
  425.       set in the reply.
  426.  
  427.  
  428. 4.  Security Considerations
  429.  
  430.    The security issues relating to ICP are discussed in the companion
  431.    document, RFCXXXX (<draft-wessels-icp-v2-appl-01.txt>).
  432.  
  433.  
  434. 5.  References
  435.  
  436.    [1] Fielding, R., et. al, "Hypertext Transfer Protocol -- HTTP/1.1",
  437.    RFC 2068, UC Irvine, January 1997.
  438.  
  439.    [2] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform Resource
  440.    Locators (URL)", RFC 1738, CERN, Xerox PARC, University of Minnesota,
  441.    December 1994.
  442.  
  443.    [3] Bowman M., Danzig P., Hardy D., Manber U., Schwartz M., and Wes-
  444.    sels D., "The Harvest Information Discovery and Access System",
  445.    Internet Research Task Force - Resource Discovery, http://har-
  446.    vest.transarc.com/.
  447.  
  448.  
  449.  
  450. Wessels                                                         [Page 8]
  451.  
  452. Internet-Draft                                             22 April 1997
  453.  
  454.  
  455.    [4] Wessels D., Claffy K., "ICP and the Squid Web Cache", National
  456.    Laboratory for Applied Network Research, http://www.nlanr.net/~wes-
  457.    sels/Papers/icp-squid.ps.gz
  458.  
  459.    [5] Wessels D., "The Squid Internet Object Cache", National Labora-
  460.    tory for Applied Network Research, http://squid.nlanr.net/Squid/
  461.  
  462.  
  463. 6.  Acknowledgments
  464.  
  465.    The authors wish to thank Paul A Vixie <paul@vix.com> for
  466.    providing excellent feedback on this document.
  467.  
  468.  
  469. 7.  Author's  Addresses:
  470.  
  471.    Duane Wessels
  472.    National Laboratory for Applied Network Research
  473.    10100 Hopkins Drive
  474.    La Jolla, CA 92093
  475.    wessels@nlanr.net
  476.  
  477.    K Claffy
  478.    National Laboratory for Applied Network Research
  479.    10100 Hopkins Drive
  480.    La Jolla, CA 92093
  481.    kc@nlanr.net
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506. Wessels                                                         [Page 9]
  507.